<template>
  <div>
    <FilterTable
      height="400"
      ref="table"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      datakey="records"
      :onColumnsChange="columns => (this.columns = columns)"
      :onSyncTableData="tableChangeFun"
      :isSelectColumn="false"
    >
    </FilterTable>
  </div>
</template>

<script>
import {dictionary} from '@/utils/dictMixin';
import {selectKP} from '@/api/partsmanage/partinfos/partInfoManage/index';

export default {
  name: 'invoiceInformation',
  components: {},
  mixins: [dictionary],
  props: {
    rowData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    this.BaseTable = null;
    return {
      visible: false,
      fetchApi: selectKP,
      fetchParams: {
        xsjsfp: '',
      },
      columns: this.createTableColumns(),
      selectArr: []
    };
  },
  async created() {
    this.rowData.bukrs == '2000'? this.fetchParams.bjpjsx=50001002:this.fetchParams.bjpjsx=50001001
    this.fetchParams.xsjsfp = this.rowData.xspjfp
    console.info( this.fetchParams)
  },
  computed: {
    getfetchParams() {
      return Object.assign({}, this.params, this.fetchParams);
    }
  },
  mounted() {
    this.BaseTable = this.$refs.table.$refs.pageTable;
  },
  methods: {
    tableChangeFun(val) {
    },
    selectChange(val) {
      this.selectArr = val
      console.log(val)
    },
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '订单号',
          dataIndex: 'xsddhm',
          sorter: true,
        },
        {
          title: '油电属性',
          dataIndex: 'ydsx',
          sorter: true,
        },
        {
          title: 'ERP号码',
          dataIndex: 'xqddhm',
          sorter: true,
        },
        {
          title: 'ERP行号',
          dataIndex: 'xqddhh',
          sorter: true,
        },
        {
          title: '配件件号',
          dataIndex: 'bjxmbh',
          sorter: true,
        },
        {
          title: '配件名称',
          dataIndex: 'bjzwmc',
          sorter: true,
        },
        {
          title: '销售价格',
          dataIndex: 'xsxsdj',
          sorter: true,
          precision: 2,
        },
        {
          title: '实收量',
          dataIndex: 'xtdjsl',
          sorter: true,
          precision: 1,
        },
        {
          title: '开票金额',
          dataIndex: 'xskpje',
          sorter: true,
          precision: 2,
        },
      ]
    },
    closeHandler(val, type) {
      this.visible = val;
      if (type === 'refresh') {
        // 重新加载
        this.fetchParams = {...this.fetchParams};
      }
    },
    closeDialog() {
      this.$emit('closeDialog')
    },
  }
};
</script>

<style lang="less" scoped>
.dialogBottmView {
  text-align: center;
}
</style>
